<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String data = (String)request.getAttribute("pcsMap");
String resultMap = (String)request.getAttribute("resultMap");
%>
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath}/echarts/echarts-all.js"></script>	
<script type="text/javascript" src="${pageContext.request.contextPath}/js/web/physical/add.js"></script>	
<title>体质分型</title>
</head>
<body>
<form id="constitutionform" class="form-horizontal" action="${pageContext.request.contextPath}/physical/print.shtml" onsubmit="windowOpener('')" method="post" target="surveywin">
	<section class="panel panel-default" style="padding: 10px;">
		<header style="width: 100%;">	
			<h2 align="center">${userSession.company==null||userSession.company==''?'清炙蕴智能诊疗系统':userSession.company}诊疗方案</h2>
			<br>
		</header>
		<div style="width: 100%;text-align: left;height:90%;">
		<table style="width: 100%;font-size: 14px;">
			  <tr style="height: 30px;">
			    <td width="25%">姓名：<input type="hidden" name="constitutionFormMap.patient_id" value="${patientResultMap.patient.id}"><input type="text" name="constitutionFormMap.patient_name"  value="${patientResultMap.patient.patient_name}"></td>
			    <td width="25%">性别：<input type="text" name="constitutionFormMap.patient_sex"  value="${patientResultMap.patient.patient_sex}"></td>
			    <td width="25%">年龄：<input type="text" name="constitutionFormMap.patient_age"  value="${patientResultMap.patient.patient_age}"></td>
			    <td width="25%">患者编号：<input type="text" name="constitutionFormMap.patient_number" disabled="true" value="${patientResultMap.patient.patient_number}"></td>
			  </tr>
			  <tr style="height: 30px;">
			    <td colspan="3">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：<input type="text" style="500px;" name="constitutionFormMap.patient_address"  value="${patientResultMap.patient.patient_address}"></td>
			  </tr>
			  <tr style="height: 30px;">
			  <td colspan="4">
				<hr style="margin: 0;">
				临床诊断：<input type="text" style="500px;" name="constitutionFormMap.conclusion" value="${physicalResult.resultName}">
				<hr style="margin: 0;">
			  </td>
			  </tr>
			</table>
			<div id="main" style="width:100%;height:250px;"></div>
			<table style="width: 100%;font-size: 14px;">
				<tr style="height: 30px;">
					<td colspan="2">体质描述：</td>
				</tr>
				<tr style="height: 30px;">
					<td colspan="2">
						<textarea rows="10" style="width:100%;vertical-align:left;" name="constitutionFormMap.treatment">
							${physicalResult.treatment}
						</textarea>
					</td>
				</tr>
			</table>
			<br>
		<label style="margin-right: 40px;float:right; ">
		医师：<input type="text" name="constitutionFormMap.doctor_name" value="${patientResultMap.user.userName}">
		</label>
		</div>
		<footer class="panel-footer text-right bg-light lter"> 
		<br>
		<button type="submit" class="btn btn-success btn-s-xs">打印</button>
		</footer>
	</section>
</form>
</body>
<script type="text/javascript">
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var data = eval(<%=data%>);
        var resultMap = eval(<%=resultMap%>);
        // 指定图表的配置项和数据
        var option = {
            title: {
                text: '各体质得分'
            },
            tooltip: {},
            legend: {
                data:['得分']
            },
            xAxis: {
                data: ["平和质","气虚质","阳虚质","阴虚质","痰湿质","湿热质","血瘀质","气郁质","特禀质"]
            },
            yAxis: {},
            series: [{
                name: '得分',
                type: 'bar',
                barWidth : 30,
              //配置样式
                itemStyle: {   
                    //通常情况下：
                    normal:{  
                        color: function (params){
                            var colorList = ['#C33531','#EFE42A','#64BD3D','#EE9201','#29AAE3','#B74AE5','#0AAF9F','#E89589','#A12352'];
                            return colorList[params.dataIndex];
                        }
                    },
                    //鼠标悬停时：
                    emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                },
                data: [data["平和质"],data["气虚质"],data["阳虚质"],data["阴虚质"],data["痰湿质"],data["湿热质"],data["血瘀质"],data["气郁质"],data["特禀质"]]
            }]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
        myChart.on('dblclick', function (params) {
        	var seldata = resultMap[params.name];
        	var resultName = seldata.resultName;
        	var conclusion = $("input[name='constitutionFormMap.conclusion']").val();
        	var treatment = $("textarea[name='constitutionFormMap.treatment']").val();
        	if(resultName.indexOf(conclusion)==-1){
        		var newconclusion=conclusion+","+seldata.resultName;
        		var newtreatment=treatment+seldata.treatment;
	        	$("input[name='constitutionFormMap.conclusion']").val(newconclusion);
	        	$("textarea[name='constitutionFormMap.treatment']").val(newtreatment);
        	}
        });
    </script>
</html>